#include<iostream>

typedef struct linkNode {
	int data;
	struct linkNode* next;
}linkNode;

typedef struct {
	linkNode* front;
	linkNode* rear;
}linkQueue;

bool initQueue(linkQueue& q) {
	q.front = q.rear = (linkNode*)malloc(sizeof(linkNode));

	if (q.front == NULL || q.rear == NULL)return false;

	q.front->next = NULL;

	return true;
}

bool isEmpty(linkQueue q) {
	if (q.front == q.rear)return true;
	else return false;
}

bool enQueue(linkQueue& q, int x) {
	linkNode* s = (linkNode*)malloc(sizeof(linkNode));

	if (s == NULL)return false;

	s->data = x;
	s->next = NULL;
	q.rear->next = s;
	q.rear = s;

	return true;
}

bool deQueue(linkQueue& q, int& x) {
	if (isEmpty(q))return false;

	linkNode* p = q.front->next;
	x = p->data;
	q.front->next = p->next;
	if (q.rear == p)q.rear = q.front;
	free(p);
	return true;
}

bool getHead(linkQueue q, int& x) {
	if (isEmpty(q))return false;

	x = q.front->next->data;

	return true;
}

int main() {

	return 0;
}
